package edu.spec.xhd.activitylifecycle;

import androidx.appcompat.app.AppCompatActivity;

import android.content.Intent;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.widget.Button;

import edu.spec.xhd.R;

public class ActivityE extends AppCompatActivity {
    private static final String TAG = ActivityE.class.getSimpleName();  // 字符串"ActivityE"

    private Button btn_normal_navigate;
    private Button btn_dialog_navigate;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_e);
        Log.e(TAG, "onCreate: ");
        initViews();
        initListeners();
    }

    @Override
    protected void onStart() {      //B
        super.onStart();
        Log.e(TAG, "onStart: ");
    }

    @Override
    protected void onResume(){      //C
        super.onResume();
        Log.e(TAG, "onResume: ");
    }

    @Override
    protected void onPause(){
        super.onPause();
        Log.e(TAG, "onPause: ");
    }

    @Override
    protected void onRestart(){
        super.onRestart();
        Log.e(TAG, "onRestart: ");  //A
    }

    @Override
    protected void onStop() {
        super.onStop();
        Log.e(TAG, "onStop: ");
    }

    @Override
    protected void onDestroy() {
        super.onDestroy();
        Log.e(TAG, "onDestroy: ");
    }

    private void initViews(){
        btn_normal_navigate = findViewById(R.id.btn_normal_navigate);
        btn_dialog_navigate = findViewById(R.id.btn_dialog_navigate);
    }

    private void initListeners(){
        btn_normal_navigate.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                Intent i = new Intent(ActivityE.this, ActivityF.class);
                startActivity(i);
            }
        });
        btn_dialog_navigate.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                Intent i = new Intent(ActivityE.this, ActivityG.class);
                startActivity(i);
            }
        });
    }



}
